#define _CRT_SECURE_NO_WARNINGS

#include "sort.h"

void Print(int* arr, int n)
{
	for (int i = 0; i < n; i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
}

//int main()
//{
//	int arr[] = { 4,3,6, 44,2,3,7,20 };
//	int n = sizeof(arr) / sizeof(arr[0]);
//	Print(arr, n);
//	//InsertSort(arr, n);
//	ShellSort(arr, n);
//	Print(arr, n);
//	return 0;
//}

void TestOP()
{
    srand((unsigned int)time(NULL));
    const int N = 100000;
    int* a1 = (int*)malloc(sizeof(int) * N);
    int* a2 = (int*)malloc(sizeof(int) * N);
    int* a3 = (int*)malloc(sizeof(int) * N);

    for (int i = 0; i < N; ++i)
    {
        a1[i] = rand();
        a2[i] = a1[i];
        a3[i] = a1[i];
    }
    int begin1 = clock();
    InsertSort(a1, N);
    int end1 = clock();

    int begin2 = clock();
    ShellSort(a2, N);
    int end2 = clock();

    int begin3 = clock();
    ShellSort2(a3, N);
    int end3 = clock();

    printf("InsertSort:%d\n", end1 - begin1);
    printf("ShellSort:%d\n", end2 - begin2);
    printf("ShellSort2:%d\n", end3 - begin3);

    free(a1);
    free(a2);
    free(a3);
}

int main()
{
    TestOP();
    return 0;
}